package main

import (
	"fmt"
	"net/http"

	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	r.GET("/book", func(c *gin.Context) {
		c.String(http.StatusOK, "look book")
	})

	r.POST("/book", func(c *gin.Context) {
		c.String(http.StatusOK, "create book")
	})

	r.PUT("/book/:id", func(c *gin.Context) {
		c.String(http.StatusOK, fmt.Sprintf("update book id：%s", c.Param("id")))
	})

	r.DELETE("/book/:id", func(c *gin.Context) {
		c.String(http.StatusOK, fmt.Sprintf("delete book id：%s", c.Param("id")))
	})

	// 匹配所有请求方法
	r.Any("/any", func(c *gin.Context) {
		c.String(http.StatusOK, "any")
	})

	r.Run()
}
